import rtconfig
Import('RTT_ROOT')
from building import *

# get current directory
cwd = GetCurrentDir()

# The set of source files associated with this SConscript file.
src = Glob('driverlib/*.c')

# starupt scripts for STM32F2xx

# add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
    src = src + ['startup/' + 'startup_gcc.c']
elif rtconfig.CROSS_TOOL == 'keil':
    src = src + ['startup/' + 'startup_ccs.c']
elif rtconfig.CROSS_TOOL == 'iar':
    src = src + ['startup/' + 'startup_ewarm.c']

path = [cwd + '',
    cwd + '/inc',
	cwd + '/driverlib']


'''    
if GetDepend(['RT_USING_BSP_CMSIS']):
    path += [cwd + '/CMSIS/CM3/CoreSupport']
    src += [cwd + '/CMSIS/CM3/CoreSupport/core_cm3.c']
elif GetDepend(['RT_USING_RTT_CMSIS']):
    path += [RTT_ROOT + '/components/CMSIS/Include']

if GetDepend('RT_USING_LWIP') == True:
	src = src + ['STM32F2x7_ETH_Driver/src/stm32f2x7_eth.c']
	path = path + [cwd + '/STM32F2x7_ETH_Driver/inc']
'''	

CPPDEFINES = ['ewarm']
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

Return('group')
